// 轮播模块
function get() {
    $.ajax({
        url: 'http://localhost:8888/api/swipers',
        success: function (res) {
            let str = ''
            res.data.forEach(item => {
                str += `
          <li class="img-effect">
                    <a href="javascript:;">
                        <img src="http://localhost:8888/uploads/${item.swiperimg}" alt="">
                    </a>
                </li>
          `
            })
            $('#lunbotu').html(str)
            layui.use('carousel', function () {

                let carousel = layui.carousel;

                // 轮播交互
                carousel.render({
                    elem: '#kr_carousel',
                    width: 720,
                    height: 300,
                    interval: 3000
                })
            })
        }
    })
}
get()

// 加载友情链接数据
function loadList() {
    $.ajax({
        url: 'http://localhost:8888/api/links',
        success: function (res) {
            let str1 = ''
            res.data.forEach((item) => {
                str1 += `
                  <dd>
                    <a href="javascript:;">
                      <img src="${'http://localhost:8888/uploads/' + item.linkicon}" alt="${item.linkname}">
                    </a>
                  </dd>
                `
            })
            $('.kr_collaborator').html(str1)
        }

    })
}

loadList()